Produced by Araxis Merge on 2022-09-08 08:48:54 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | /Volumes/Data 1/Ampps/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme/app/code/Mageplaza/LayeredNavigation/view/frontend/web/js/view | layer.js | 2022-04-29 13:34:30 +0000 |
| 2 | Theme Files/Magento 2.x/Porto Theme/app/code/Mageplaza/LayeredNavigation/view/frontend/web/js/view | layer.js | 2021-04-19 08:08:50 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 14 | 666 |
| Changed | 3 | 7 |
| Inserted | 3 | 26 |
| Removed | 7 | 176 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | /** | 1 | /** | |||
| 2 | * Mageplaza | 2 | * Mageplaza | |||
| 3 | * | 3 | * | |||
| 4 | * NOTICE OF LICENSE | 4 | * NOTICE OF LICENSE | |||
| 5 | * | 5 | * | |||
| 6 | * This source file is subject to the Mageplaza.com license sliderConfig is | 6 | * This source file is subject to the Mageplaza.com license sliderConfig is | |||
| 7 | * available through the world-wide-web at this URL: | 7 | * available through the world-wide-web at this URL: | |||
| 8 | * https://www.mageplaza.com/LICENSE.txt | 8 | * https://www.mageplaza.com/LICENSE.txt | |||
| 9 | * | 9 | * | |||
| 10 | * DISCLAIMER | 10 | * DISCLAIMER | |||
| 11 | * | 11 | * | |||
| 12 | * Do not edit or add to this file if you wish to upgrade this extension to newer | 12 | * Do not edit or add to this file if you wish to upgrade this extension to newer | |||
| 13 | * version in the future. | 13 | * version in the future. | |||
| 14 | * | 14 | * | |||
| 15 | * @category Mageplaza | 15 | * @category Mageplaza | |||
| 16 | * @package Mageplaza_LayeredNavigation | 16 | * @package Mageplaza_LayeredNavigation | |||
| 17 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | 17 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | |||
| 18 | * @license https://www.mageplaza.com/LICENSE.txt | 18 | * @license https://www.mageplaza.com/LICENSE.txt | |||
| 19 | */ | 19 | */ | |||
| 20 | 20 | |||||
| 21 | define([ | 21 | define([ | |||
| 22 | 'jquery', | 22 | 'jquery', | |||
| 23 | 'Mageplaza_AjaxLayer/js/action/submit-filter', | 23 | 'Mageplaza_AjaxLayer/js/action/submit-filter', | |||
| 24 | 'Magento_Catalog/js/price-utils', | 24 | 'Magento_Catalog/js/price-utils', | |||
| 25 | 'jquery/ui | 25 | 'jquery-ui-modules/widget', | |||
| 26 | 'accordion', | 26 | 'accordion', | |||
| 27 | 'productListToolbarForm' | 27 | 'productListToolbarForm' | |||
| 28 | ], function ($, submitFilterAction, ultil) { | 28 | ], function ($, submitFilterAction, ultil) { | |||
| 29 | "use strict"; | 29 | "use strict"; | |||
| 30 | var next_page = ""; | |||||
| 31 | var loading = false; | |||||
| 32 | var infinite_loaded_count = 0; | |||||
| 33 | var active = false; | |||||
| 34 | 30 | |||||
| 35 | $.widget('mageplaza.layer', $.mage.accordion, { | 31 | $.widget('mageplaza.layer', $.mage.accordion, { | |||
| 36 | options: { | 32 | options: { | |||
| 37 | openedState: 'active', | 33 | openedState: 'active', | |||
| 38 | collapsible: true, | 34 | collapsible: true, | |||
| 39 | multipleCollapsible: true, | 35 | multipleCollapsible: true, | |||
| 40 | animate: 200, | 36 | animate: 200, | |||
| 41 | productsListSelector: '#layer-product-list', | |||||
| 42 | mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', | 37 | mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', | |||
| 43 | collapsibleElement: '[data-role=ln_collapsible]', | 38 | collapsibleElement: '[data-role=ln_collapsible]', | |||
| 44 | header: '[data-role=ln_title]', | 39 | header: '[data-role=ln_title]', | |||
| 45 | content: '[data-role=ln_content]', | 40 | content: '[data-role=ln_content]', | |||
| 46 | isCustomerLoggedIn: false, | 41 | isCustomerLoggedIn: false, | |||
| 47 | isAjax: true, | 42 | isAjax: true, | |||
| 48 | params: [], | 43 | params: [], | |||
| 49 | active: [], | 44 | active: [], | |||
| 50 | checkboxEl: 'input[type=checkbox] | 45 | checkboxEl: 'input[type=checkbox], input[type=radio]', | |||
| 51 | sliderElementPrefix: '#ln_slider_', | 46 | sliderElementPrefix: '#ln_slider_', | |||
| 52 | sliderTextElementPrefix: '#ln_slider_text_' | 47 | sliderTextElementPrefix: '#ln_slider_text_' | |||
| 53 | }, | 48 | }, | |||
| 54 | 49 | |||||
| 55 | inFinite: function() { | |||||
| 56 | var self = this; | |||||
| 57 | next_page = ""; | |||||
| 58 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | |||||
| 59 | active = true; | |||||
| 60 | } | |||||
| 61 | $(".pages-items li > a.next").each(function(){ | |||||
| 62 | next_page = $(this).attr("href"); | |||||
| 63 | }); | |||||
| 64 | if(!next_page){ | |||||
| 65 | $('.infinite-loader').hide(); | |||||
| 66 | } | |||||
| 67 | $(".infinite-loader .btn-load-more").click(function(){ | |||||
| 68 | if(!loading && next_page){ | |||||
| 69 | loading = true; | |||||
| 70 | self.ajaxInfinite(next_page); | |||||
| 71 | } | |||||
| 72 | }); | |||||
| 73 | }, | |||||
| 74 | ||||||
| 75 | ajaxInfinite: function (submitUrl) { | |||||
| 76 | var self = this; | |||||
| 77 | infinite_loaded_count++; | |||||
| 78 | $('.infinite-loader .btn-load-more').hide(); | |||||
| 79 | $('.infinite-loader .loading').show(); | |||||
| 80 | $.ajax({ | |||||
| 81 | url: submitUrl, | |||||
| 82 | type: 'get', | |||||
| 83 | beforeSend: function () { | |||||
| 84 | $('.infinite-loader .btn-load-more').hide(); | |||||
| 85 | $('.infinite-loader .loading').show(); | |||||
| 86 | }, | |||||
| 87 | success: function (res) { | |||||
| 88 | loading = false; | |||||
| 89 | var $products = $(res.products); | |||||
| 90 | if (res.backUrl) { | |||||
| 91 | window.location = res.backUrl; | |||||
| 92 | return; | |||||
| 93 | } | |||||
| 94 | if($products){ | |||||
| 95 | $products.each(function(i,el){ | |||||
| 96 | if($(el).hasClass('products-grid')){ | |||||
| 97 | var items_grid = $(this).find('.product-items .item'); | |||||
| 98 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | |||||
| 99 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||||
| 100 | } | |||||
| 101 | if($(el).hasClass('products-list')){ | |||||
| 102 | var items_list = $(this).find('.product-items .item'); | |||||
| 103 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | |||||
| 104 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||||
| 105 | } | |||||
| 106 | if($(el).hasClass('toolbar-products')){ | |||||
| 107 | if($(this).find('.pages a.next').length > 0){ | |||||
| 108 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); | |||||
| 109 | }else{ | |||||
| 110 | $(self.options.productsListSelector + ' .pages a.next').remove(); | |||||
| 111 | } | |||||
| 112 | } | |||||
| 113 | }); | |||||
| 114 | if($("form[data-role=tocart-form]").length > 0) { | |||||
| 115 | $("form[data-role=tocart-form]").catalogAddToCart(); | |||||
| 116 | } | |||||
| 117 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | |||||
| 118 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | |||||
| 119 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | |||||
| 120 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | |||||
| 121 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | |||||
| 122 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | |||||
| 123 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | |||||
| 124 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | |||||
| 125 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | |||||
| 126 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | |||||
| 127 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | |||||
| 128 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | |||||
| 129 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | |||||
| 130 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | |||||
| 131 | var hist = submitUrl; | |||||
| 132 | if(submitUrl.indexOf("p=") > -1){ | |||||
| 133 | var len = submitUrl.length-submitUrl.indexOf("p="); | |||||
| 134 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | |||||
| 135 | var page_param = ""; | |||||
| 136 | if(str_temp.indexOf("&") == -1){ | |||||
| 137 | page_param = str_temp; | |||||
| 138 | } else { | |||||
| 139 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | |||||
| 140 | } | |||||
| 141 | hist = submitUrl.replace(page_param, ""); | |||||
| 142 | } | |||||
| 143 | if (typeof window.history.pushState === 'function') { | |||||
| 144 | window.history.pushState({url: hist}, '', hist); | |||||
| 145 | } | |||||
| 146 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||||
| 147 | requirejs(['jquery', 'weltpixel_quickview' ], | |||||
| 148 | function($, quickview) { | |||||
| 149 | $('.weltpixel-quickview').off('click').on('click', function() { | |||||
| 150 | var prodUrl = $(this).attr('data-quickview-url'); | |||||
| 151 | if (prodUrl.length) { | |||||
| 152 | quickview.displayContent(prodUrl); | |||||
| 153 | } | |||||
| 154 | }); | |||||
| 155 | }); | |||||
| 156 | } | |||||
| 157 | $(".products-grid .weltpixel-quickview").each(function(){ | |||||
| 158 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | |||||
| 159 | }); | |||||
| 160 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||||
| 161 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||||
| 162 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | |||||
| 163 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||||
| 164 | }); | |||||
| 165 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||||
| 166 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||||
| 167 | }); | |||||
| 168 | } | |||||
| 169 | self.initWishlistCompare(); | |||||
| 170 | next_page = ""; | |||||
| 171 | $(".pages-items li > a.next").each(function(){ | |||||
| 172 | next_page = $(this).attr("href"); | |||||
| 173 | }); | |||||
| 174 | $('.infinite-loader .loading').hide(); | |||||
| 175 | if(next_page){ | |||||
| 176 | $('.infinite-loader .btn-load-more').show(); | |||||
| 177 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | |||||
| 178 | if(!loading && next_page){ | |||||
| 179 | loading = true; | |||||
| 180 | self.ajaxInfinite(next_page); | |||||
| 181 | } | |||||
| 182 | }); | |||||
| 183 | } | |||||
| 184 | } | |||||
| 185 | ||||||
| 186 | }, | |||||
| 187 | error: function () { | |||||
| 188 | window.location.reload(); | |||||
| 189 | } | |||||
| 190 | }); | |||||
| 191 | }, | |||||
| 192 | ||||||
| 193 | _create: function () { | 50 | _create: function () { | |||
| 194 | this.initActiveItems(); | 51 | this.initActiveItems(); | |||
| 195 | 52 | |||||
| 196 | this._super(); | 53 | this._super(); | |||
| 197 | 54 | |||||
| 198 | this.initProductListUrl(); | 55 | this.initProductListUrl(); | |||
| 199 | this.initObserve(); | 56 | this.initObserve(); | |||
| 200 | this.initSlider(); | 57 | this.initSlider(); | |||
| 201 | this.initWishlistCompare(); | 58 | this.initWishlistCompare(); | |||
| 202 | this.selectedAttr(); | 59 | this.selectedAttr(); | |||
| 60 | this.renderCategoryTree(); | |||||
| 203 | }, | 61 | }, | |||
| 204 | 62 | |||||
| 205 | initActiveItems: function () { | 63 | initActiveItems: function () { | |||
| 206 | var layerActives = this.options.active, | 64 | var layerActives = this.options.active, | |||
| 207 | actives = []; | 65 | actives = []; | |||
| 208 | if ($(".page-layout-1column").length){ | |||||
| 209 | this.options.multipleCollapsible = false; | |||||
| 210 | } | |||||
| 211 | 66 | |||||
| 212 | if (typeof window.layerActiveTabs !== 'undefined') { | 67 | if (typeof window.layerActiveTabs !== 'undefined') { | |||
| 213 | layerActives = window.layerActiveTabs; | 68 | layerActives = window.layerActiveTabs; | |||
| 214 | } | 69 | } | |||
| 215 | if (layerActives.length) { | 70 | if (layerActives.length) { | |||
| 216 | this.element.find('.filter-options-item').each(function (index) { | 71 | this.element.find('.filter-options-item').each(function (index) { | |||
| 217 | if (~$.inArray($(this).attr('attribute'), layerActives)) { | 72 | if (~$.inArray($(this).attr('attribute'), layerActives)) { | |||
| 218 | actives.push(index); | 73 | actives.push(index); | |||
| 219 | } | 74 | } | |||
| 220 | }); | 75 | }); | |||
| 221 | } | 76 | } | |||
| 222 | 77 | |||||
| 223 | this.options.active = actives; | 78 | this.options.active = actives; | |||
| 224 | 79 | |||||
| 225 | return this; | 80 | return this; | |||
| 226 | }, | 81 | }, | |||
| 227 | 82 | |||||
| 228 | initProductListUrl: function () { | 83 | initProductListUrl: function () { | |||
| 229 | var isProcessToolbar = false, | 84 | var isProcessToolbar = false, | |||
| 230 | isAjax = this.options.isAjax; | 85 | isAjax = this.options.isAjax; | |||
| 231 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | 86 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | |||
| 232 | if (isProcessToolbar) { | 87 | if (isProcessToolbar) { | |||
| 233 | return; | 88 | return; | |||
| 234 | } | 89 | } | |||
| 235 | if (isAjax) { | 90 | if (isAjax) { | |||
| 236 | isProcessToolbar = true; | 91 | isProcessToolbar = true; | |||
| 237 | } | 92 | } | |||
| 238 | 93 | |||||
| 239 | var urlPaths = this.options.url.split('?'), | 94 | var urlPaths = this.options.url.split('?'), | |||
| 240 | baseUrl = urlPaths[0], | 95 | baseUrl = urlPaths[0], | |||
| 241 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | 96 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | |||
| 242 | paramData = {}, | 97 | paramData = {}, | |||
| 243 | parameters; | 98 | parameters; | |||
| 244 | for (var i = 0; i < urlParams.length; i++) { | 99 | for (var i = 0; i < urlParams.length; i++) { | |||
| 245 | parameters = urlParams[i].split('='); | 100 | parameters = urlParams[i].split('='); | |||
| 246 | paramData[parameters[0]] = parameters[1] !== undefined | 101 | paramData[parameters[0]] = parameters[1] !== undefined | |||
| 247 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | 102 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | |||
| 248 | : ''; | 103 | : ''; | |||
| 249 | } | 104 | } | |||
| 250 | paramData[paramName] = paramValue; | 105 | paramData[paramName] = paramValue; | |||
| 251 | if (paramValue === defaultValue) { | 106 | if (paramValue === defaultValue) { | |||
| 252 | delete paramData[paramName]; | 107 | delete paramData[paramName]; | |||
| 253 | } | 108 | } | |||
| 254 | paramData = $.param(paramData); | 109 | paramData = $.param(paramData); | |||
| 255 | if (isAjax) { | 110 | if (isAjax) { | |||
| 256 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | 111 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | |||
| 257 | } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); | 112 | } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); | |||
| 258 | } | 113 | } | |||
| 259 | }, | 114 | }, | |||
| 260 | 115 | |||||
| 261 | initObserve: function () { | 116 | initObserve: function () { | |||
| 262 | var self = this; | 117 | var self = this; | |||
| 263 | var isAjax = this.options.isAjax; | 118 | var isAjax = this.options.isAjax; | |||
| 264 | infinite_loaded_count = 0; | |||||
| 265 | 119 | |||||
| 266 | // fix browser back, forward button | 120 | // fix browser back, forward button | |||
| 267 | if (typeof window.history.replaceState === "function") { | 121 | if (typeof window.history.replaceState === "function") { | |||
| 268 | window.history.replaceState({url: document.URL}, document.title); | 122 | window.history.replaceState({url: document.URL}, document.title); | |||
| 269 | 123 | |||||
| 270 | setTimeout(function () { | 124 | setTimeout(function () { | |||
| 271 | window.onpopstate = function (e) { | 125 | window.onpopstate = function (e) { | |||
| 272 | if (e.state) { | 126 | if (e.state) { | |||
| 273 | submitFilterAction(e.state.url, 1); | 127 | submitFilterAction(e.state.url, 1); | |||
| 274 | } | 128 | } | |||
| 275 | }; | 129 | }; | |||
| 276 | }, 0) | 130 | }, 0) | |||
| 277 | } | 131 | } | |||
| 278 | 132 | |||||
| 279 | var pageElements = $('#layer-product-list').find('.pages a'); | 133 | var pageElements = $('#layer-product-list').find('.pages a'); | |||
| 280 | pageElements.each(function () { | 134 | pageElements.each(function () { | |||
| 281 | var el = $(this), | 135 | var el = $(this), | |||
| 282 | link = self.checkUrl(el.prop('href')); | 136 | link = self.checkUrl(el.prop('href')); | |||
| 283 | if (!link) { | 137 | if (!link) { | |||
| 284 | return; | 138 | return; | |||
| 285 | } | 139 | } | |||
| 286 | 140 | |||||
| 287 | el.bind('click', function (e) { | 141 | el.bind('click', function (e) { | |||
| 288 | e.stopPropagation(); | 142 | e.stopPropagation(); | |||
| 289 | e.preventDefault(); | 143 | e.preventDefault(); | |||
| 290 | if (isAjax) { | 144 | if (isAjax) { | |||
| 291 | submitFilterAction(link); | 145 | submitFilterAction(link); | |||
| 292 | } | 146 | } else location.href = link; | |||
| 293 | | |||||
| 294 | }) | 147 | }) | |||
| 295 | }); | 148 | }); | |||
| 296 | 149 | |||||
| 297 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | 150 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | |||
| 298 | currentElements.each(function (index) { | 151 | currentElements.each(function (index) { | |||
| 299 | var el = $(this), | 152 | var el = $(this), | |||
| 300 | link = self.checkUrl(el.prop('href')); | 153 | link = self.checkUrl(el.prop('href')); | |||
| 301 | if (!link) { | 154 | if (!link) { | |||
| 302 | return; | 155 | return; | |||
| 303 | } | 156 | } | |||
| 304 | 157 | |||||
| 305 | el.bind('click', function (e) { | 158 | el.bind('click', function (e) { | |||
| 306 | e.stopPropagation(); | 159 | e.stopPropagation(); | |||
| 307 | e.preventDefault(); | 160 | e.preventDefault(); | |||
| 308 | if (isAjax) { | 161 | if (isAjax) { | |||
| 309 | submitFilterAction(link); | 162 | submitFilterAction(link); | |||
| 163 | } else { | |||||
| 164 | location.href = link; | |||||
| 310 | } | 165 | } | |||
| 311 | else location.href = link; | |||||
| 312 | }); | 166 | }); | |||
| 313 | }); | 167 | }); | |||
| 314 | 168 | |||||
| 315 | var optionElements = this.element.find('.filter-options a'); | 169 | var optionElements = this.element.find('.filter-options a'); | |||
| 316 | optionElements.each(function (index) { | 170 | optionElements.each(function (index) { | |||
| 317 | var el = $(this), | 171 | var el = $(this), | |||
| 318 | link = self.checkUrl(el.prop('href')); | 172 | link = self.checkUrl(el.prop('href')); | |||
| 319 | if (!link) { | 173 | if (!link) { | |||
| 320 | return; | 174 | return; | |||
| 321 | } | 175 | } | |||
| 322 | 176 | |||||
| 323 | el.bind('click', function (e) { | 177 | el.bind('click', function (e) { | |||
| 324 | if (el.hasClass('swatch-option-link-layered')) { | 178 | if (el.hasClass('swatch-option-link-layered')) { | |||
| 325 | self.selectSwatchOption(el); | 179 | self.selectSwatchOption(el); | |||
| 326 | } else { | 180 | } else { | |||
| 327 | var checkboxEl = el.siblings(self.options.checkboxEl); | 181 | var checkboxEl = el.siblings(self.options.checkboxEl); | |||
| 328 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | 182 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | |||
| 329 | } | 183 | } | |||
| 330 | 184 | |||||
| 331 | e.stopPropagation(); | 185 | e.stopPropagation(); | |||
| 332 | e.preventDefault(); | 186 | e.preventDefault(); | |||
| 333 | self.ajaxSubmit(link); | 187 | self.ajaxSubmit(link); | |||
| 334 | }); | 188 | }); | |||
| 335 | 189 | |||||
| 336 | var checkbox = el.siblings(self.options.checkboxEl); | 190 | var checkbox = el.siblings(self.options.checkboxEl); | |||
| 337 | checkbox.bind('click', function (e) { | 191 | checkbox.bind('click', function (e) { | |||
| 338 | e.stopPropagation(); | 192 | e.stopPropagation(); | |||
| 339 | self.ajaxSubmit(link); | 193 | self.ajaxSubmit(link); | |||
| 340 | }); | 194 | }); | |||
| 341 | }); | 195 | }); | |||
| 342 | 196 | |||||
| 343 | var swatchElements = this.element.find('.swatch-attribute'); | 197 | var swatchElements = this.element.find('.swatch-attribute'); | |||
| 344 | swatchElements.each(function (index) { | 198 | swatchElements.each(function (index) { | |||
| 345 | var el = $(this); | 199 | var el = $(this); | |||
| 346 | var attCode = el.attr('attribute-code'); | 200 | var attCode = el.attr('attribute-code'); | |||
| 347 | if (attCode) { | 201 | if (attCode) { | |||
| 348 | if (self.options.params.hasOwnProperty(attCode)) { | 202 | if (self.options.params.hasOwnProperty(attCode)) { | |||
| 349 | var attValues = self.options.params[attCode].split(","); | 203 | var attValues = self.options.params[attCode].split(","); | |||
| 350 | var swatchOptions = el.find('.swatch-option'); | 204 | var swatchOptions = el.find('.swatch-option'); | |||
| 351 | swatchOptions.each(function (option) { | 205 | swatchOptions.each(function (option) { | |||
| 352 | var elOption = $(this); | 206 | var elOption = $(this); | |||
| 353 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | 207 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | |||
| 354 | elOption.addClass('selected'); | 208 | elOption.addClass('selected'); | |||
| 355 | } | 209 | } | |||
| 356 | }); | 210 | }); | |||
| 357 | } | 211 | } | |||
| 358 | } | 212 | } | |||
| 359 | }); | 213 | }); | |||
| 360 | ||||||
| 361 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||||
| 362 | requirejs(['jquery', 'weltpixel_quickview' ], | |||||
| 363 | function($, quickview) { | |||||
| 364 | $('.weltpixel-quickview').off('click').on('click', function() { | |||||
| 365 | var prodUrl = $(this).attr('data-quickview-url'); | |||||
| 366 | if (prodUrl.length) { | |||||
| 367 | quickview.displayContent(prodUrl); | |||||
| 368 | } | |||||
| 369 | }); | |||||
| 370 | }); | |||||
| 371 | } | |||||
| 372 | ||||||
| 373 | $(".products-grid .weltpixel-quickview").each(function(){ | |||||
| 374 | $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); | |||||
| 375 | }); | |||||
| 376 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||||
| 377 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||||
| 378 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||||
| 379 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||||
| 380 | }); | |||||
| 381 | } | |||||
| 382 | if(isAjax) { | |||||
| 383 | self.inFinite(); | |||||
| 384 | }else{ | |||||
| 385 | $('.infinite-loader').hide(); | |||||
| 386 | } | |||||
| 387 | ||||||
| 388 | }, | 214 | }, | |||
| 389 | 215 | |||||
| 390 | selectSwatchOption: function (el) { | 216 | selectSwatchOption: function (el) { | |||
| 391 | var childEl = el.find('.swatch-option'); | 217 | var childEl = el.find('.swatch-option'); | |||
| 392 | if (childEl.hasClass('selected')) { | 218 | if (childEl.hasClass('selected')) { | |||
| 393 | childEl.removeClass('selected'); | 219 | childEl.removeClass('selected'); | |||
| 394 | } else { | 220 | } else { | |||
| 395 | childEl.addClass('selected'); | 221 | childEl.addClass('selected'); | |||
| 396 | } | 222 | } | |||
| 397 | }, | 223 | }, | |||
| 398 | 224 | |||||
| 399 | initSlider: function () { | 225 | initSlider: function () { | |||
| 400 | var self = this, | 226 | var self = this, | |||
| 401 | slider = this.options.slider; | 227 | slider = this.options.slider; | |||
| 402 | 228 | |||||
| 403 | for (var code in slider) { | 229 | for (var code in slider) { | |||
| 404 | if (slider.hasOwnProperty(code)) { | 230 | if (slider.hasOwnProperty(code)) { | |||
| 405 | var sliderConfig = slider[code], | 231 | var sliderConfig = slider[code], | |||
| 406 | sliderElement = self.element.find(this.options.sliderElementPrefix + code), | 232 | sliderElement = self.element.find(this.options.sliderElementPrefix + code), | |||
| 407 | priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; | 233 | priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; | |||
| 408 | 234 | |||||
| 409 | if (sliderElement.length) { | 235 | if (sliderElement.length) { | |||
| 410 | sliderElement.slider({ | 236 | sliderElement.slider({ | |||
| 411 | range: true, | 237 | range: true, | |||
| 412 | min: sliderConfig.minValue, | 238 | min: sliderConfig.minValue, | |||
| 413 | max: sliderConfig.maxValue, | 239 | max: sliderConfig.maxValue, | |||
| 414 | values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], | 240 | values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], | |||
| 415 | slide: function (event, ui) { | 241 | slide: function (event, ui) { | |||
| 416 | self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); | 242 | self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); | |||
| 417 | }, | 243 | }, | |||
| 418 | change: function (event, ui) { | 244 | change: function (event, ui) { | |||
| 419 | self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); | 245 | self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); | |||
| 420 | } | 246 | } | |||
| 421 | }); | 247 | }); | |||
| 422 | } | 248 | } | |||
| 423 | self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); | 249 | self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); | |||
| 424 | } | 250 | } | |||
| 425 | } | 251 | } | |||
| 426 | }, | 252 | }, | |||
| 427 | 253 | |||||
| 428 | displaySliderText: function (code, from, to, format) { | 254 | displaySliderText: function (code, from, to, format) { | |||
| 429 | var textElement = this.element.find(this.options.sliderTextElementPrefix + code); | 255 | var textElement = this.element.find(this.options.sliderTextElementPrefix + code); | |||
| 430 | if (textElement.length) { | 256 | if (textElement.length) { | |||
| 431 | if (format !== null) { | 257 | if (format !== null) { | |||
| 432 | from = this.formatPrice(from, format); | 258 | from = this.formatPrice(from, format); | |||
| 433 | to = this.formatPrice(to, format); | 259 | to = this.formatPrice(to, format); | |||
| 434 | } | 260 | } | |||
| 435 | 261 | |||||
| 436 | textElement.html(from + ' - ' + to); | 262 | textElement.html(from + ' - ' + to); | |||
| 437 | } | 263 | } | |||
| 438 | }, | 264 | }, | |||
| 439 | 265 | |||||
| 440 | getSliderUrl: function (url, from, to) { | 266 | getSliderUrl: function (url, from, to) { | |||
| 441 | return url.replace('from-to', from + '-' + to); | 267 | return url.replace('from-to', from + '-' + to); | |||
| 442 | }, | 268 | }, | |||
| 443 | 269 | |||||
| 444 | formatPrice: function (value, format) { | 270 | formatPrice: function (value, format) { | |||
| 445 | return ultil.formatPrice(value, format); | 271 | return ultil.formatPrice(value, format); | |||
| 446 | }, | 272 | }, | |||
| 447 | 273 | |||||
| 448 | ajaxSubmit: function (submitUrl) { | 274 | ajaxSubmit: function (submitUrl) { | |||
| 449 | var isAjax = this.options.isAjax; | 275 | var isAjax = this.options.isAjax; | |||
| 450 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | 276 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | |||
| 451 | 277 | |||||
| 452 | if (isAjax) { | 278 | if (isAjax) { | |||
| 453 | return submitFilterAction(submitUrl); | 279 | return submitFilterAction(submitUrl); | |||
| 454 | } | 280 | } | |||
| 455 | location.href = submitUrl; | 281 | location.href = submitUrl; | |||
| 456 | }, | 282 | }, | |||
| 457 | 283 | |||||
| 458 | checkUrl: function (url) { | 284 | checkUrl: function (url) { | |||
| 459 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | 285 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | |||
| 460 | 286 | |||||
| 461 | return regex.test(url) ? url : null; | 287 | return regex.test(url) ? url : null; | |||
| 462 | }, | 288 | }, | |||
| 463 | 289 | |||||
| 464 | //Handling 'add to wishlist' & 'add to compare' event | 290 | //Handling 'add to wishlist' & 'add to compare' event | |||
| 465 | initWishlistCompare: function () { | 291 | initWishlistCompare: function () { | |||
| 466 | var isAjax = this.options.isAjax; | 292 | var isAjax = this.options.isAjax; | |||
| 467 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | 293 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | |||
| 468 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | 294 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | |||
| 469 | $(elClass).each(function () { | 295 | $(elClass).each(function () { | |||
| 470 | var el = $(this); | 296 | var el = $(this); | |||
| 471 | $(el).bind('click', function (e) { | 297 | $(el).bind('click', function (e) { | |||
| 472 | var dataPost = $(el).data('post'), | 298 | var dataPost = $(el).data('post'), | |||
| 473 | formKey = $('input[name="form_key"]').val(); | 299 | formKey = $('input[name="form_key"]').val(); | |||
| 474 | if (formKey) { | 300 | if (formKey) { | |||
| 475 | dataPost.data.form_key = formKey; | 301 | dataPost.data.form_key = formKey; | |||
| 476 | } | 302 | } | |||
| 477 | 303 | |||||
| 478 | var paramData = $.param(dataPost.data), | 304 | var paramData = $.param(dataPost.data), | |||
| 479 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | 305 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | |||
| 480 | 306 | |||||
| 481 | e.stopPropagation(); | 307 | e.stopPropagation(); | |||
| 482 | e.preventDefault(); | 308 | e.preventDefault(); | |||
| 483 | 309 | |||||
| 484 | if (isAjax && el.hasClass('towishlist')) { | 310 | if (isAjax && el.hasClass('towishlist')) { | |||
| 485 | submitFilterAction(url, true); | 311 | submitFilterAction(url, true); | |||
| 486 | } else if (isAjax) { | 312 | } else if (isAjax) { | |||
| 487 | submitFilterAction(url); | 313 | submitFilterAction(url); | |||
| 488 | } else location.href = url; | 314 | } else location.href = url; | |||
| 489 | }); | 315 | }); | |||
| 490 | }) | 316 | }) | |||
| 491 | }, | 317 | }, | |||
| 492 | 318 | |||||
| 493 | //Selected attribute color after page load. | 319 | //Selected attribute color after page load. | |||
| 494 | selectedAttr: function () { | 320 | selectedAttr: function () { | |||
| 495 | var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); | 321 | var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); | |||
| 496 | 322 | |||||
| 497 | filterCurrent.each(function(){ | 323 | filterCurrent.each(function(){ | |||
| 498 | var el = $(this), | 324 | var el = $(this), | |||
| 499 | colorLabel = el.html(), | 325 | colorLabel = el.html(), | |||
| 500 | colorAttr = $('.filter-options .filter-options-item .color .swatch-option-link-layered .swatch-option'); | 326 | colorAttr = $('.filter-options .filter-options-item .color .swatch-option-link-layered .swatch-option'); | |||
| 501 | 327 | |||||
| 502 | colorAttr.each(function(){ | 328 | colorAttr.each(function(){ | |||
| 503 | var elA = $(this); | 329 | var elA = $(this); | |||
| 504 | if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ | 330 | if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ | |||
| 505 | elA.addClass('selected'); | 331 | elA.addClass('selected'); | |||
| 506 | } | 332 | } | |||
| 507 | }); | 333 | }); | |||
| 508 | }); | 334 | }); | |||
| 335 | }, | |||||
| 336 | ||||||
| 337 | renderCategoryTree: function () { | |||||
| 338 | var iconExpand = this.element.find('.filter-options .icon-expand'); | |||||
| 339 | ||||||
| 340 | iconExpand.each(function () { | |||||
| 341 | var el = $(this); | |||||
| 342 | ||||||
| 343 | el.nextAll('ol').each(function() { | |||||
| 344 | if($(this).find('input[checked]').length !== 0 | |||||
| 345 | && !$(this).prevAll('.icon-expand').hasClass('active') | |||||
| 346 | ) { | |||||
| 347 | $(this).show(); | |||||
| 348 | $(this).prevAll('.icon-expand').toggleClass('active'); | |||||
| 349 | } | |||||
| 350 | }); | |||||
| 351 | ||||||
| 352 | el.bind('click', function (e) { | |||||
| 353 | el.nextAll('ol').toggle(); | |||||
| 354 | el.toggleClass('active'); | |||||
| 355 | e.stopPropagation(); | |||||
| 356 | }); | |||||
| 357 | }); | |||||
| 509 | } | 358 | } | |||
| 510 | }); | 359 | }); | |||
| 511 | 360 | |||||
| 512 | return $.mageplaza.layer; | 361 | return $.mageplaza.layer; | |||
| 513 | }); | 362 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.